package tech.pdai.springframework.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;
import tech.pdai.springframework.bean.Car;

@Configuration
public class MainConfig {

    /**
     * 单实例bean
     * @return
     */
    @Bean(initMethod = "myInit", destroyMethod = "myDestroy")
    public Car car01() {
        return new Car();
    }

    /**
     * 多实例bean
     * @return
     */
    @Scope(value = "prototype")
    @Bean(initMethod = "myInit", destroyMethod = "myDestroy")
    public Car car02() {
        return new Car();
    }
}
